<template>
  <div class="couponBox">
    <div class="item" v-for="(v, i) in dataInfo" :key="i">
      <div class="money">
        <h3><span>￥</span>{{ v.coupon_price }}</h3>
        <p>满87元可用</p>
      </div>
      <div class="text">
        <div class="t_top">
          <span class="gray">通用</span>
          <span>{{ v.coupon_title }}</span>
        </div>
        <div class="t_bootom">
          <span>{{ v.end_time }}</span>
          <p>已领取</p>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref, onMounted } from "vue";
import { coupon } from "../../api/index";
const dataInfo = ref([]);
onMounted(() => {
  coupon().then((res) => {
    dataInfo.value = res.data;
  });
});
</script>

<style lang="less">
.couponBox {
  width: 100%;
  height: 100%;
  background: #f5f5f5;
  padding: 10px;
  overflow: auto;
  .item {
    width: 100%;
    height: 93px;
    margin-bottom: 8px;
    display: flex;
    .money {
      background-image: url();
      background-repeat: no-repeat;
      background-size: 100% 100%;
      padding: 10px 35px;
      display: flex;
      flex-direction: column;
      align-items: center;
      color: white;
      justify-content: center;
      h3 {
        font-weight: 800;
        span {
          font-size: 16px;
        }
      }
      p {
        font-size: 16px;
      }
    }
    .text {
      width: 248px;
      flex: 1;
      padding: 0 9px 0 13px;
      box-sizing: border-box;
      background-color: #fff;
      .t_top {
        font-size: 16px;
        color: #282828;
        height: 51px;
        line-height: 51px;
        border-bottom: 0.5px solid #f0f0f0;
        .gray {
          width: 49px;
          padding: 1px 5px;
          box-sizing: border-box;
          background: #fff7f7;
          border: 1px solid #cccccc;
          opacity: 1;
          border-radius: 11px;
          font-size: 11px;
          color: #cccccc;
          margin-right: 6px;
        }
      }
      .t_bootom {
        display: flex;
        align-items: center;
        justify-content: space-between;
        span {
          font-size: 11px;
          color: #999;
        }
        p {
          background-color: #ccc;
          width: 75px;
          height: 24px;
          border-radius: 12px;
          font-size: 12px;
          text-align: center;
          line-height: 24px;
          color: #fff;
        }
      }
    }
  }
}
</style>
